@extends('home.layout')
@section('content')
    <!-- ngView:  -->

<div class="ng-scope" ng-view="" role="main">
    <div profile-container="" page-name="changepassword" page-title="更改密码" class="profile-container container">
        <div class="clearfix">
            <div location="" class="location" ng-style="{visibility: geohash ? '' : 'hidden'}" role="navigation"><span>当前位置:</span>
                <span class="location-current"><a href="{{asset('')}}place/wx4spk2q4gx" class="inherit ng-binding" ng-href="/place/wx4spk2q4gx" ubt-click="401" ng-bind="place.name || place.address">昌平区沙河兄弟连IT教育(北清路北400米)</a></span>
                <span class="location-change location-hashistory" ng-class="{ 'location-hashistory': user.username &amp;&amp; userPlaces &amp;&amp; userPlaces.length > 0 }"><a href="{{asset('')}}home" ng-href="/home" ubt-click="400" hardjump="">[切换地址]</a><ul class="dropbox location-dropbox" ubt-visit="398"><li class="arrow"></li>
        <!-- ngRepeat: userPlace in userPlaces | filter:filterPlace | limitTo: 4 -->
                <li class="ng-scope" href="{{asset('')}}place/wx4spk28vey" class="inherit ng-binding" ng-href="/place/wx4spk28vey" ng-bind="userPlace.name" ubt-click="399">昌平区沙河北京华文学院附近</a></li>
    <!-- end ngRepeat: userPlace in userPlaces | filter:filterPlace | limitTo: 4 -->
                <li class="changelocation"><a href="{{asset('')}}home" ng-href="/home" hardjump="">修改收货地址<span class="icon-location"></span></a></li></ul></span> <span ng-transclude=""><i class="icon-arrow-right ng-scope"></i><span class="ng-binding ng-scope">更改密码</span></span>
            </div>
            <div search-input=""></div>
        </div>
        <ul profile-sidebar="" class="profile-sidebar" role="navigation">
            <li class="profile-sidebar-section"><h2 class="profile-sidebar-sectiontitle" ng-class="{ active: pageName === 'profile' }"><i class="icon-line-home"></i><a href="{{asset('')}}profile">个人中心</a></h2></li>
            <li class="profile-sidebar-section"><h2 class="profile-sidebar-sectiontitle"><i class="icon-line-order"></i>我的订单
                </h2>
                <ul>
                    <li ng-class="{ active: pageName === 'order' }"><a
                                href="{{asset('')}}profile/order">近三个月订单</a></li>
                    <li ng-class="{ active: pageName === 'order-unrated' }"><a
                                href="{{asset('')}}profile/order/unrated">待评价订单<!-- ngIf: unratedNumber --></a>
                    </li>
                </ul>
            </li>
            <li class="profile-sidebar-section"><h2 class="profile-sidebar-sectiontitle"><i class="icon-line-profile"></i>我的资料</h2>
                <ul>
                    <li ng-class="{ active: pageName === 'info' }"><a href="{{asset('')}}profile/info">个人资料</a>
                    </li>
                    <li ng-class="{ active: pageName === 'address' }"><a
                                href="{{asset('')}}profile/address">地址管理</a></li>
                    <li class="active" ng-class="{ active: pageName === 'changepassword' }"><a href="#">修改密码</a></li>
                </ul>
            </li>
            <li class="profile-sidebar-section"><h2 class="profile-sidebar-sectiontitle"
                                                    ng-class="{ active: pageName === 'favor' }"><a
                            href="{{asset('')}}profile/favor"><i class="icon-order-favor"></i>我的收藏</a></h2></li>
        </ul>
        <div class="profile-panel" role="main"><!-- ngIf: pageTitleVisible --><h3 ng-if="pageTitleVisible" class="profile-paneltitle ng-scope">
                <span class="ng-binding" ng-bind="pageTitle">更改密码</span> 
                <span class="subtitle ng-binding" ng-bind-html="pageSubtitle | toTrusted">
                </span>
            </h3><!-- end ngIf: pageTitleVisible -->
            <div class="profile-panelcontent" ng-transclude="">



            <!--  action = "{{url('profile/security/dochange')}}" -->
            <!-- form表单  修改密码 -->
                <form method="post" action="{{url('profile/security/dochange')}}" class="changepwd ng-scope ng-pristine ng-valid" ng-submit="changePwdSubmit()" novalidate=""><p class="changepwd-tip">饿了么提示你：使用大小写字母、数字与标点符号的组合，可以大幅提升帐号安全！</p>
                {{csrf_field()}}
                <!-- ngIf: !firstSet -->
                @if(session('info'))
                  <script type="text/javascript">      
                      alert('{{session('info')}}');
                  </script>  
                @endif
                <div id="tipcode" display="none" height="20px"></div> 
                    <div ng-if="!firstSet" form-field="" label="当前密码" model="changePwdData" property="currentPwd"
                         class="formfield ng-isolate-scope"
                         ng-class="{ 'validate-error': model.$hintTypes[property] === 'error' }"><label class="ng-binding" ng-bind="label">当前密码</label>
                         <input id="currentcode"class="ng-scope ng-pristine ng-valid" name="current" ng-model="changePwdData.currentPwd" placeholder="请输入当前密码" type="password">
                        <div class="formfield-hint">
                            <span class="ng-binding" ng-class="{ 'icon-dot-error': model.$hintTypes[property] === 'error', 'icon-dot-warning': model.$hintTypes[property] === 'warning' }"
                            ng-bind="model.$hints[property]">
                            </span>
                        </div>
                    </div><!-- end ngIf: !firstSet -->
                    <div form-field="" label="新密码" model="changePwdData" property="newPwd" class="formfield ng-isolate-scope" ng-class="{ 'validate-error': model.$hintTypes[property] === 'error' }"><label class="ng-binding" ng-bind="label">新密码</label>
                    <input id="password" class="ng-scope ng-pristine ng-valid" name="password" ng-model="changePwdData.newPwd"   ng-minlength="6" maxlength="20" placeholder="请输入新密码" type="password">
                    <div class="formfield-hint">
                        <span class="ng-binding" ng-class="{ 'icon-dot-error': model.$hintTypes[property] === 'error', 'icon-dot-warning': model.$hintTypes[property] === 'warning' }" ng-bind="model.$hints[property]">
                        </span>
                    </div>
                    </div>
                    <div form-field="" label="确认密码" model="changePwdData" property="confirmPwd" class="formfield ng-isolate-scope" ng-class="{ 'validate-error': model.$hintTypes[property] === 'error' }">
                        <label class="ng-binding" ng-bind="label">确认密码</label>
                        <input id="repassword" class="ng-scope ng-pristine ng-valid" name="confirm" ng-model="changePwdData.confirmPwd"  ng-minlength="6" maxlength="20" placeholder="请再次输入密码" type="password">
                        <div class="formfield-hint">
                            <span class="ng-binding" ng-class="{ 'icon-dot-error': model.$hintTypes[property] === 'error', 'icon-dot-warning': model.$hintTypes[property] === 'warning' }" ng-bind="model.$hints[property]">
                            </span>
                        </div>
                    </div>
                    <div form-field="" class="form-group formfield ng-isolate-scope"
                         ng-class="{ 'validate-error': model.$hintTypes[property] === 'error' }"><label class="ng-binding" ng-bind="label"></label>
                        <button id="resure" type="submit" class="btn-primary btn-lg ng-scope">确认</button>
                        <div class="formfield-hint">
                            <span class="ng-binding" ng-class="{ 'icon-dot-error': model.$hintTypes[property] === 'error', 'icon-dot-warning': model.$hintTypes[property] === 'warning' }"ng-bind="model.$hints[property]">
                            </span>
                        </div>
                    </div>
                    <input type="hidden" name="id" value="{{session('master') -> id}}"/>
                </form>

            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    window.onload = function(){
    
            
            //验证当前密码
           $("#currentcode").blur(function(){
                  if($("#currentcode").val()=="")
                  {
                     $("#tipcode").css('display', 'block').html("<font color=red>当前密码不能为空</font>");
                     return false;
                  }

                  if($("#currentcode").val().length < 6)
                  {
                      $("#tipcode").css('display', 'block').html("<font color=red>密码长度6-20字符</font>");
                      return false;
                  }
                 
            });

           $("#currentcode").focus(function()
            {
              $("#tipcode").css('display', 'none');
            });

         //验证密码
           $("#password").blur(function(){
                  if($("#password").val()=="")
                  {
                     $("#tipcode").css('display', 'block').html("<font color=red>新密码不能为空</font>");
                     return false;
                  }

                  if($("#password").val().length < 6 )
                  {
                      $("#tipcode").css('display', 'block').html("<font color=red>密码长度6-20字符</font>");
                      return false;
                  }
            });
           $("#password").focus(function()
            {
              $("#tipcode").css('display', 'none');
            });
            
             //验证确定密码
           $("#repassword").blur(function(){
                  if($("#repassword").val()=="")
                  {
                     $("#tipcode").css('display', 'block').html("<font color=red>确认密码不能为空</font>");
                     return false;
                  }

                  if($("#repassword").val().length < 6 )
                  {
                      $("#tipcode").css('display', 'block').html("<font color=red>密码长度6-20字符</font>");
                      return false;
                  }
            });
           $("#repassword").focus(function()
            {
              $("#tipcode").css('display', 'none');
            });
    }

</script>
@endsection